import React, { useEffect, useRef } from "react";

const Resize = () => {
  const ref = useRef();

  useEffect(() => {
    var observer = new ResizeObserver((e) => {
      console.log(e[0].contentRect.height);
    });
    observer.observe(ref.current);
  }, []);

  return (
    <textarea
      name="textarea"
      rows={10}
      cols={50}
      style={{ width: "200px" }}
      ref={ref}
      defaultValue="Write something here"
    />
  );
};

export default Resize;
